package com.yonyou.cyxdms.sysAuth.service.mapper;

import com.yonyou.cyx.framework.dao.base.SuperMapper;
import com.yonyou.cyxdms.sysAuth.service.entity.ConsultantWorkPO;
import com.yonyou.cyxdms.sysAuth.service.entity.EmpPo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author tanjie
 * @since 2019-08-14
 */
public interface ConsultantWorkMapper extends SuperMapper<ConsultantWorkPO> {

    List<ConsultantWorkPO> getWorkConsultantRatio(@Param("ownerCode") String ownerCode,
                                                  @Param("workDay") Integer workDay);


    List<ConsultantWorkPO> getRatioByClues(@Param("ownerCode") String ownerCode, @Param("workDay") Integer workDay);

    Integer getCluesByConsul(@Param("ownerCode") String ownerCode, @Param("workDay") Integer workDay);

    Integer resetClues();

    Integer updateConsultantClues(@Param("consultId")String consultId, @Param("num")Integer num);

    Integer updateConsultWorkTime(@Param("consultId")String consultId, @Param("workDay") String toString);

    Integer updateConsultRatio(@Param("consultId") String counsultId, @Param("ratio") Integer ratio);

    /**
     * 当前当前经销商下顾问
     *
     * @param flag      为true查询所有配置了分配规则的顾问，false则查询所有
     *                  未分配规则的顾问
     * @param consultId 查询待分配线索包含此ID的所有顾问
     * @return:
     * @auther: tanjie
     * @since: 2019/8/29
     */
    List<EmpPo> queryAllotConsultant(@Param("ownerCode") String ownerCode, @Param("flag") Boolean flag,
                                     @Param("consultId") String consultId);

    Boolean updateConsultByConsultId(String consultantId);

    Integer deleteByConsultantId(@Param("ownerCode") String ownerCode, @Param("consultId") String consultId);

}
